package com.zjsd.sqeybusiness.controller;

import java.util.List;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.zjsd.sqeybusiness.domain.Hyinfo;
import com.zjsd.sqeybusiness.service.IHyinfoService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 会员信息Controller
 *
 * @author Zheng
 * @date 2025-03-06
 */
@RestController
@RequestMapping("/sqeybusiness/hyinfo")
public class HyinfoController extends BaseController
{
    @Autowired
    private IHyinfoService hyinfoService;

    /**
     * 查询会员信息列表
     */
    @PreAuthorize("@ss.hasPermi('sqeybusiness:hyinfo:list')")
    @GetMapping("/list")
    public TableDataInfo list(Hyinfo hyinfo)
    {
        startPage();
        List<Hyinfo> list = hyinfoService.selectHyinfoList(hyinfo);
        return getDataTable(list);
    }

    /**
     * 导出会员信息列表
     */
    @PreAuthorize("@ss.hasPermi('sqeybusiness:hyinfo:export')")
    //@Log(title = "会员信息", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(Hyinfo hyinfo)
    {
        List<Hyinfo> list = hyinfoService.selectHyinfoList(hyinfo);
        ExcelUtil<Hyinfo> util = new ExcelUtil<Hyinfo>(Hyinfo.class);
        return util.exportExcel(list, "hyinfo");
    }

    /**
     * 获取会员信息详细信息
     */
    @PreAuthorize("@ss.hasPermi('sqeybusiness:hyinfo:query')")
    @GetMapping(value = "/{hyid}")
    public AjaxResult getInfo(@PathVariable("hyid") Long hyid)
    {
        return AjaxResult.success(hyinfoService.selectHyinfoById(hyid));
    }

    /**
     * 新增会员信息
     */
    @PreAuthorize("@ss.hasPermi('sqeybusiness:hyinfo:add')")
    //@Log(title = "会员信息", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody Hyinfo hyinfo)
    {
        return toAjax(hyinfoService.insertHyinfo(hyinfo));
    }

    /**
     * 修改会员信息
     */
    @PreAuthorize("@ss.hasPermi('sqeybusiness:hyinfo:edit')")
    //@Log(title = "会员信息", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody Hyinfo hyinfo)
    {
        return toAjax(hyinfoService.updateHyinfo(hyinfo));
    }

    /**
     * 删除会员信息
     */
    @PreAuthorize("@ss.hasPermi('sqeybusiness:hyinfo:remove')")
    //@Log(title = "会员信息", businessType = BusinessType.DELETE)
	@DeleteMapping("/{hyids}")
    public AjaxResult remove(@PathVariable Long[] hyids)
    {
        return toAjax(hyinfoService.deleteHyinfoByIds(hyids));
    }
}
